//
// Copyright 2021 Google Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//

@use 'sass:map';
@use '@material/theme/theme';
@use '@material/theme/keys';
@use '@material/tokens/resolvers';
@use './chip-theme';

$_light-theme: (
  container-shape: null,
  container-height: null,
  container-elevation: null,
  outline-color: null,
  outline-width: null,
  container-shadow-color: null,
  label-text-font: null,
  label-text-line-height: null,
  label-text-size: null,
  label-text-weight: null,
  label-text-tracking: null,
  label-text-color: null,
  with-trailing-icon-trailing-icon-size: null,
  with-trailing-icon-trailing-icon-color: null,
  with-leading-icon-leading-icon-size: null,
  with-leading-icon-leading-icon-color: null,
  with-avatar-avatar-size: null,
  with-avatar-avatar-shape: null,
  disabled-outline-color: null,
  disabled-outline-opacity: null,
  disabled-label-text-color: null,
  disabled-label-text-opacity: null,
  with-trailing-icon-disabled-trailing-icon-color: null,
  with-trailing-icon-disabled-trailing-icon-opacity: null,
  with-leading-icon-disabled-leading-icon-color: null,
  with-leading-icon-disabled-leading-icon-opacity: null,
  with-avatar-disabled-avatar-opacity: null,
  hover-state-layer-color: null,
  hover-state-layer-opacity: null,
  hover-label-text-color: null,
  with-trailing-icon-hover-trailing-icon-color: null,
  with-leading-icon-hover-leading-icon-color: null,
  focus-state-layer-color: null,
  focus-state-layer-opacity: null,
  focus-label-text-color: null,
  focus-outline-color: null,
  with-trailing-icon-focus-trailing-icon-color: null,
  with-leading-icon-focus-leading-icon-color: null,
  pressed-state-layer-color: null,
  pressed-state-layer-opacity: null,
  pressed-label-text-color: null,
  with-trailing-icon-pressed-trailing-icon-color: null,
  with-leading-icon-pressed-leading-icon-color: null,
  container-surface-tint-layer-color: null,
);

$_custom-property-prefix: 'input-chip';

@mixin theme($theme, $resolvers: resolvers.$material) {
  @include theme.validate-theme($_light-theme, $theme);
  $theme: chip-theme.resolve-theme($theme, $resolvers: $resolvers);
  @include keys.declare-custom-properties(
    $theme,
    $prefix: $_custom-property-prefix
  );
}

@mixin theme-styles($theme, $resolvers: resolvers.$material) {
  @include theme.validate-theme-styles($_light-theme, $theme);
  $theme: keys.create-theme-properties(
    $theme,
    $prefix: $_custom-property-prefix
  );
  @include chip-theme.theme-styles($theme, $resolvers: $resolvers);
}
